package modelz;

import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;

public class UpdateableSet<T extends Updateable<T>> extends
		UpdateableCollection<T> {

	public UpdateableSet(ObjectFactory client) {
		super(client);
	}

	protected final Set<T> items = new HashSet<T>();

	public T create(Class<T> cls) throws InstantiationException {
		T item = createInstance(cls);
		items.add(item);
		return item;
	}

	protected void performRemove(T item) {
		items.remove(item);
	}

	public int size() {
		return items.size();
	}

	public Iterator<T> iterator() {
		return items.iterator();
	}

	protected void performClear() {
		items.clear();
	}

}
